# -*- coding: utf-8 -*-

from datetime import datetime
from pydantic import BaseModel, validator
from typing import Any, Dict
from enum import Enum

from app.models.request import BaseModelLocal

class TagBase(BaseModel):    
    name: str | None = None

class TagCreate(TagBase):
    pass

class TagUpdate(TagBase):
    pass

class Tag(TagBase, BaseModelLocal):
    class Config:
        from_attributes = True
#----------------------------------------------------------------------


class AttachmentCategory(str, Enum):
    image = "image"
    video = "video"
    audio = "audio"
    file = "file"

# 0: created, 1: uploading, 2: success, 3: failed, 
class AttachmentStatus(int, Enum):
    created = 0
    uploading = 1
    success = 2
    failed = 3


class AttachmentBase(BaseModel):    
    name: str | None = None
    category: AttachmentCategory | None = None
    content_type: str | None = None
    size: int | None = None
    hash: str | None = None


class AttachmentCreate(AttachmentBase):
    pass

class AttachmentUpdate(AttachmentBase):
    pass

class Attachment(AttachmentBase, BaseModelLocal):
    status: AttachmentStatus | None = None
    url: str | None = None
    class Config:
        from_attributes = True
#----------------------------------------------------------------------
class TopicBase(BaseModel):    
    title: str | None = None
    content: str | None = None
    category: int | None = None
    status: int | None = None

class TopicCreate(TopicBase):
    pass

class TopicUpdate(TopicBase):
    pass

class Topic(TopicBase, BaseModelLocal):
    class Config:
        from_attributes = True